Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am doing something about the joystick, all I want to do is to access the value of the x,y,z axis, and now I have got the x y axis value already, but I can't even detect z axis, and can't get the value of z axis, what should i do?
Posted

1 solution

There is absolutely nothing special about Z axis.

You Z axis can be rotational or not implemented in your device; or you mixed up Z axis with another degree of freedom such as rudder (which has a different API in DirectX input library (do you use DirectX?)). It can be a result of some bug. It's hard to say anything else based on your information.

—SA
 
Share this answer
 
Comments
robotics_study 25-Apr-11 5:02am    
I called GetDeviceState(), and got the value of x and y axis from the structure of DIJOYSTATE, but the z axis and the button information could not be accessed. I have these sentences:
if(pdidoi->guidType==GUID_XAxis) AfxMessageBox("x_axis");
if(pdidoi->guidType==GUID_YAxis) AfxMessageBox("y_axis");
if(pdidoi->guidType==GUID_ZAxis) AfxMessageBox("z_axis");
and the pdidoi is a pointer to DIDEVICEOBJECTINSTANCE, run the program, "y_axis" and "x_axis" have appeared, but "z_axis" not. Could you tell me the reasons? Thanks a lot!
Sergey Alexandrovich Kryukov 25-Apr-11 5:37am    
What is Z in device, physically? It could be a different degree of freedom, all I can think of for now.
Move all axis and look for DIJOYSTATE or DIJOYSTATE2.
I don't see guidType member; you need to use DIJOYSTATE.x, DIJOYSTATE.y, etc. Just dump all the structure is some text, write into text edit control and watch what really changed in the structure.
--SA
robotics_study 26-Apr-11 22:10pm    
I have done those you said. And I use DIJOYSTATE.lX,lY,and lZ, only lX,and lY can have values, while the lZ is always zero. I am puzzled. Can you give me your email, and I send my progect to you. And do me a favor to check my code, thanks a lot!
Sergey Alexandrovich Kryukov 26-Apr-11 22:45pm    
You see, I don't have any joystick at the moment; without it won't help much. I remember I got it all from the first attempt -- 3D joystick with .NET 2.0.
My web site has "contact me" page, see my profile.
--SA
Sergey Alexandrovich Kryukov 26-Apr-11 22:47pm    
My idea way: dump this structure to the screen ***in full***, every single member of it; watch it while moving the joystick.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900